<?php

$w = $this->getImageHeight(); /*width*/
$h = $this->getImageWidth(); /*height*/
$products = $this->getProductList();

/*Get Category Title*/
$cateName = array();
foreach($products as $key => $id){
    $cateName[$key] = $this->getCategoryNameById($key);
}

//产品配置项
$homeUrl    = $this->getUrl('');//网站首页路径
$this_store = Mage::app()->getStore()->getStoreId();//视图判断
$skin_url   = $this->getSkinUrl();//当前皮肤路径
$img = ($this_store == '2') ? $skin_url.'images/landing-page/icod/ru/' : $skin_url.'images/landing-page/icod/en/';
?>
<style type="text/css">
    .em-wrapper-header .em-header-style31 .navbar-fixed-top{display: none !important;}
</style>
<div class="album_list">

    <div  class="nav-activity">
        <div class="nav-activity-title">
            <h1><?php echo $this->getMainTitle();?></h1>
        </div>
       <div class="nav-activity-list">
            <ul>
                <li><a href="<?php echo $homeUrl ?>guarantee/"><img src="<?php echo $img ?>New_3.png" alt=""></a></li>
                <li><a href="<?php echo $homeUrl ?>delivery/"><img src="<?php echo $img ?>New_4.png" alt=""></a></li>
                <li><a href="<?php echo $homeUrl ?>about_rumall/"><img src="<?php echo $img ?>New_5.png" alt=""></a></li>
                <li><a href="<?php echo $homeUrl ?>returns_refunds/"><img src="<?php echo $img ?>New_6.png" alt=""></a></li>
                <li><a href="<?php echo $homeUrl ?>delivery/"><img src="<?php echo $img ?>New_7.png" alt=""></a></li>
                <li><a href="<?php echo $homeUrl ?>payment/"><img src="<?php echo $img ?>New_8.png" alt=""></a></li>
                <li><a href="<?php echo $homeUrl ?>about_rumall/"><img src="<?php echo $img ?>New_9.png" alt=""></a></li>
            </ul>
       </div>
    </div>  

    <div class="nav-wrapper-fixed" id="navFixed" style="display:none;">
        <div class="nav">
            <ul class="Category-entity-name-fixed">
             <?php foreach ($cateName as $namekey => $name): ?>
                <li>
                    <a href="#icod-<?php echo $namekey; ?>" class="activ-estatus-<?php echo $namekey; ?>" class="activ-style">
                        <i class="fa icon-sf-<?php echo $namekey; ?>"></i>
                        <span><?php echo $name;?></span>
                    </a>
                </li>
                <?php endforeach ?>
            </ul>
        </div>
    </div>

    <div class="activity-category" style="width:1200px;margin:0 auto; ">
     <div style="padding:10px;">
        <div class="Category-nav-name">
            <div class="Category-nav-name-title">
                <h2><?php echo $this->__('Category');?></h2>
            </div>
            <div class="nav-wrapper">
                <div class="nav" id="nav">
                <ul class="Category-entity-name">
                 <?php foreach ($cateName as $namekey => $name): ?>
                    <li>
                    <a href="#icod-<?php echo $namekey; ?>" class="activ-estatus-<?php echo $namekey; ?>">
                        <i class="fa icon-sf-<?php echo $namekey; ?>"></i>
						<span><?php echo $name;?></span>
                    </a>
                    </li>
                 <?php endforeach ?>
                </ul >
                </div>
            </div>
        </div>

        <div class="categoty-content">
        <?php foreach ($products as $productId => $products): ?>
           <!-- <h3>titleaName</h3> -->
            <h3 id="<?php echo $products['categoryarrName']; ?>" name="#<?php echo $productId?>" class="active-nav-fixed">
                <?php echo $products['categoryarrName']; ?>
                <a id="<?php echo $productId ?>" name="icod-<?php echo $productId?>">&nbsp;</a>
                <a href="<?php echo $products['categoryarrUrl'] ?>" style="float:right;font-size:14px;">
                    <span><?php echo $this->__('more');?><i class="fa fa-angle-double-right">&nbsp;</i></span>
                </a>
            </h3>
            <ul class="emcatalog-grid-mode products-grid" >
                <?php foreach ($products['product'] as $productId => $product): ?>
                <li class="item first col-sm-5" >
                    <div class="product-item" >
                        <div class="product-shop-top">
                            
                            <a href="<?php echo $product['productUrl'] ?>" title="<?php echo $product['productName']; ?>" class="product-image">
                                <img class="img-responsive em-alt-hover lazy" src="<?php echo $product['productimgUrl01']; ?>" width="<?php echo $w; ?>" height="<?php echo $h; ?>" 
                                alt="<?php echo $product['productName']; ?>" />
                                <img class="img-responsive em-alt-org lazy" src="<?php echo $product['productimgUrl02'];?>" width="<?php echo $w; ?>" height="<?php echo $h; ?>" 
                                alt="<?php echo $product['productName']; ?>" id="product-collection-image-<?php echo $productId ?>" />
                                <span class="bkg-hover"></span>
                            </a>
                            <div class="bottom">
                                 <?php if($product['addToCart']): ?>
                                    <button type="button" title="<?php echo $product['addToCart']?>" class="button btn-cart" onclick="setinfo('<?php echo $product['productUrl'] ?>')">
                                    <span>
                                    </span>
                                    </button>
                                <?php else: ?>
                                    <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                                <?php endif; ?>
                                <ul class="add-to-links">
                                    <?php if ($product['addToWishlist']) : ?>
                                        <li>
                                            <a href="<?php echo  $product['addToWishlist']?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?>
                                            </a>
                                        </li>
                                    <?php endif; ?>
                                    <?php if($product['addToCompare'] ): ?>
                                        <li><a href="<?php echo $product['addToCompare'] ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('Add to Compare') ?></a></li>
                                <?php endif; ?>
                            </div>
                        </div>
                        
                       <div class="product-shop">
                            <div class="f-fix" >
                                <!--product name-->
                                <h2 class="product-name text-center">
                                    <a href="<?php echo $product['productUrl'] ?>" title="<?php echo $product['productName']; ?>" ><?php echo $product['productName']; ?>
                                    </a>
                                </h2>

                                <div style="text-align:left">
                                    <span class="price line-through"><?php echo $product['currencyPrice']; ?></span>
                                    <span class="finalprice"><?php echo $product['currencyFinalPrice']; ?> </span>
                                </div>
                                
                                <div class="desc std text-center em-element-display-hover">
                                  <?php echo  $product['shortdes'] ; ?>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </li> 
                <?php endforeach ?>
            </ul>
        <?php endforeach ?>
        <div class="nodata"></div>
        </div>

        </div>
    </div> 
</div>


<script type="text/javascript">
//<![CDATA[

(function($){

    $('.em-header-style31').css("margin","0px");
    $('.em-wrapper-main .container-main').css({"margin":"0px","padding":"0px","width":"100%"});
    $('.em-main-container.em-col1-layout >div.row').css('margin','0');
    $('.em-main-container.em-col1-layout >div.row >div.em-col-main').css('padding','0');

    jQuery(window).scroll(function() {
        var tops = [], top = jQuery(this).scrollTop() + 90;
        jQuery('.categoty-content').find('.active-nav-fixed').each(function() {
            tops.push(jQuery(this).offset().top);
        });
       
        for (var i = 0; i< tops.length; ++i) {
            if (typeof tops[i + 1] == 'undefined') {
                jQuery('#navFixed .Category-entity-name-fixed').find('a').removeClass('activ-style').last().addClass('activ-style');
            }else {    
                if (top >= tops[i] && top < tops[i + 1]) {
                    jQuery('#navFixed .Category-entity-name-fixed').find('a').removeClass('activ-style').eq(i).addClass('activ-style');
                return;
                }
            }
        }
    });

})(jQuery);
    function setinfo(url){
        window.location.href=url;
    }

</script>
<script type="text/javascript">
     window.onload = function () {
         var nav = document.getElementById('nav');
         var navFixed = document.getElementById('navFixed');
         window.onscroll = function () {
             var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
             // document.title = scrollTop
             if (scrollTop > nav.offsetTop+300) {
                 navFixed.style.display = 'block';
             } else if (scrollTop < nav.offsetTop+300) {
                 navFixed.style.display = 'none';
             }
         }
     };


//]]>
 </script>